﻿@model ListViewModel<CommonSearchValues, IQueryable<UserMemo>>
@{
    int i = Model.PageIdx * Model.PageSize;
    var rds = SiteUser.UserAllRecupers.Where(v => v.GuoQi == false).SelectMany(v => v.QizSubjectObjForDoctors).OrderByDescending(v => v.TimeMark).Distinct();
    var items = rds.Select(v => new { RecuperID = v.RecuperID, Title = v.Doctor.UserName }).Distinct().ToList();
    items.Add(new { RecuperID = "", Title = "[私人备忘录]" });    
}

@foreach (var item in Model.Data)
{
    <li>
        <table class="timetable">
            <tr>
                <td class="timemark">&nbsp;</td>
                <td class="timeline">&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td class="timemark">
                    <h2>@item.CreateTime.ToString("d日")</h2>
                    <span>@item.CreateTime.ToString("yyyy年M月")</span>
                </td>
                <td class="timeline">
                    <img src="/Content/images/@(i % 2 == 0 ? "arrow-green.png" : "arrow-gray.png")" width="14" height="25"/>
                </td>
                <td class="sfcard @(i % 2 == 0 ? "greencard" : "graycard")  ui-overlay-shadow">
                    <a style="padding:0px; text-align:left;vertical-align:top;box-shadow:none; background-color:transparent;border-style:none;" data-role="button" href="@Url.Action("MemoEdit", new { id = item.ID })">
                        <h3 style="color: #000;">@Html.FixStrSuffix(item.Title, 12)</h3>
                        @if (item.Recuper == null)
                        {
                            <h4 style="color: #000;">私人备忘录</h4>
                        }
                        else
                        {
                            <h4 style="color: #000;">@((items.FirstOrDefault(v => v.RecuperID == item.RecuperID) ?? (new { RecuperID = "", Title = "" })).Title)</h4>
                                
                            
                        }
                    </a>
                </td>
            </tr>
            <tr>
                <td class="timemark">&nbsp;</td>
                <td class="timeline">&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
        </table>
    </li>
                        i++;
}
